<?php
/**
 * Object Main_Social
 * @author SillySmart
 * @copyright SillySmart
 * @package Mvc.Models.Objects
 * @see Sls.Models.Core.SLS_FrontModel
 * @since 1.0
 */
class Main_Social extends SLS_FrontModel
{
	/**
	 * Class variables
	 */
	protected $__social_id;
	protected $__social_name;
	protected $__social_url;
	protected $_table = "social";
	protected $_db = "main";
	protected $_primaryKey = "social_id";
	protected $_fks = array();
	public $_typeErrors = array();

	/**
	 * Constructor Main_Social
	 * @author SillySmart
	 * @copyright SillySmart
	 * @param bool $mutlilanguage true if multilanguage content, else false
	 */
	public function __construct($multilanguage=false)
	{
		parent::__construct($multilanguage);
		$this->buildDefaultValues();
	}

	/**
	 * Build default values for specific columns
	 * @author SillySmart
	 * @copyright SillySmart
	 */
	public function buildDefaultValues()
	{
	}

	/**
	 * Set the value of social_name
	 * Errors can be catched with the public variable $this->_typeErrors['social_name']
	 * @author SillySmart
	 * @copyright SillySmart
	 * @param string $value
	 * @return bool true if updated, false if not
	 */
	public function setSocialName($value)
	{
		if ($value === "")
		{
			$this->_typeErrors['social_name'] = "E_EMPTY";
			return false;
		}

		if (is_null($value))
		{
			$this->_typeErrors['social_name'] = "E_NULL";
			return false;
		}

		if ($this->__social_name == $value)
			return true;

		if (strlen($value) > 127)
		{
			$this->_typeErrors['social_name'] = "E_LENGTH";
			return false;
		}

		$this->__set('social_name', $value);
		return true;
	}

	/**
	 * Set the value of social_url
	 * Errors can be catched with the public variable $this->_typeErrors['social_url']
	 * @author SillySmart
	 * @copyright SillySmart
	 * @param string $value
	 * @return bool true if updated, false if not
	 */
	public function setSocialUrl($value)
	{
		if (!SLS_String::isValidUrl($value))
		{
			$this->_typeErrors['social_url'] = "E_TYPE";
			return false;
		}

		if ($value === "")
		{
			$this->_typeErrors['social_url'] = "E_EMPTY";
			return false;
		}

		if (is_null($value))
		{
			$this->_typeErrors['social_url'] = "E_NULL";
			return false;
		}

		if ($this->__social_url == $value)
			return true;

		if (strlen($value) > 255)
		{
			$this->_typeErrors['social_url'] = "E_LENGTH";
			return false;
		}

		$this->__set('social_url', $value);
		return true;
	}

}
?>